const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  entry: './src/js/app.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'app.js'
  },
  module: {
    rules: [
      
        // html-loader
        {
          test: /\.(html)$/,
          use: {
              loader: 'html-loader'
          }
      },
    ]
  },
  // 设置别名
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    },
    enforceExtension: false,
    extensions: ['.js', '.json', '.css', '.scss']
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './src/index.html',
      filename: 'index.html'
    }),
  ]
}